<?php echo $head ?>
<div class="right-content">
    <div class="clearfix">
        <form action="/admin/jurisdiction/add_apply" method="post" class="form-horizontal form ajaxfrom we7-form"
              role="form" id="form-user">
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">用户名</label>
                <div class="col-sm-10 col-lg-9 col-xs-12">
                    <input id="" name="username" type="text" class="form-control" value="">
                    <span class="help-block">请输入用户名，用户名为 3 到 15 个字符组成，包括汉字，大小写字母（不区分大小写）</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">密码</label>
                <div class="col-sm-10 col-lg-9 col-xs-12">
                    <input id="password" name="password" type="password" class="form-control" value=""
                           autocomplete="off">
                    <span class="help-block">请填写密码，最小长度为 8 个字符</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">确认密码</label>
                <div class="col-sm-10 col-lg-9 col-xs-12">
                    <input id="repassword" name="repassword" type="password" class="form-control" value=""
                           autocomplete="off">
                    <span class="help-block">重复输入密码，确认正确输入</span>
                </div>
            </div>
            <?php if ($grade == 0) { ?>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">级别</label>
                    <div class="col-sm-10 col-lg-9 col-xs-12">
                        <select name="grade">
                            <option value="1">超级管理员</option>
                            <option value="2" selected>管理员</option>
                        </select>

                        <span class="help-block" style="color: red">超级管理员不用选择权限</span>
                    </div>
                </div>
            <?php } ?>
            <!--            上级权限设置-->
            <div class="form-group module-permission">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">权限设置</label>
                <div class="col-sm-10 col-lg-10 col-xs-12">
                    <?php foreach ($jur_1 as $k => $v) { ?>
                        <div class="col-sm-4 dropdown">
                            <span class="checkbox">
                            <input id="check-child-<?php echo $v['id'] ?>" type="checkbox"
                                   value="<?php echo $v['id'] ?>" name="jur_1[]"
                                   onclick="ch_click(<?php echo $v['id'] ?>)">
                            <label for="check-child-<?php echo $v['id'] ?>" data-toggle="tooltip" data-original-title=""
                                   title=""><?php echo $v['name'] ?></label>
                        </span>
                        </div>
                    <?php } ?>
                </div>
            </div>

            <!--            子级权限设置-->
            <div class="form-group module-permission">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">次级权限设置</label>
                <div class="col-sm-10 col-lg-10 col-xs-12">
                    <?php foreach ($jur_2 as $k => $v) { ?>
                        <div class="col-sm-10 col-lg-10 col-xs-12 plugin-name jur_2_<?php echo $v['data']['id'] ?>" style="display: none"><?php echo $v['data']['name'] ?></div>
                            <?php foreach ($v['list'] as $key=>$val) { ?>
                            <div class="col-sm-4 dropdown jur_2_<?php echo $v['data']['id'] ?>" style="display: none">
                                <span class="checkbox">
                                    <input id="check-child-<?php echo $val['id']?>" type="checkbox" value="<?php echo $val['id']?>" class="checkbox_jur_2_<?php echo $v['data']['id']?>" name="jur_2[]">
                                    <label for="check-child-<?php echo $val['id']?>" data-toggle="tooltip" data-original-title=""
                                           title=""><?php echo $val['name']?></label>
                                </span>
                            </div>

                        <?php } ?>
                    <?php } ?>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-md-offset-2 col-lg-offset-1 col-xs-12 col-sm-10 col-md-10 col-lg-11">
                    <input type="submit" class="btn btn-primary span3" name="submit" value="提交">
                </div>
            </div>
        </form>

        <script>
            function ch_click(j_cliss) {
                if ($("#check-child-" + j_cliss).get(0).checked) {
                    $('.checkbox_jur_2_'+j_cliss).prop("checked",true);
                    $('.jur_2_'+j_cliss).css("display","block");
                    //选中
                } else {
                    //取消选中
                    $('.checkbox_jur_2_'+j_cliss).prop("checked",false);
                    $('.jur_2_'+j_cliss).css("display","none");
                }
            }
        </script>
